﻿#region

using System.Collections.Generic;
using System.Web.Mvc;

#endregion

namespace HouseHoldBudget.Framework.Mvc.Helpers
{
    public static class EnumerableExtension
    {
        #region Class Methods

        /// <summary>
        ///   Serializes to json.
        /// </summary>
        /// <typeparam name="T"> </typeparam>
        /// <param name="objectToSerialize"> The object to serialize. </param>
        /// <returns> </returns>
        public static JsonResult SerializeToJson<T>(this IEnumerable<T> objectToSerialize)
        {
            return new JsonResult
                       {
                           Data = objectToSerialize,
                       };
        }

        #endregion
    }
}